package com.yunhe.tianhe.rentcars.service.cheliangguanli.impl;

import com.yunhe.tianhe.commons.dto.Pageable;
import com.yunhe.tianhe.rentcars.dao.cheliangguanli.PriceDao;
import com.yunhe.tianhe.rentcars.dao.cheliangguanli.WeiXiuDao;
import com.yunhe.tianhe.rentcars.entity.cheliangguanli.Price;
import com.yunhe.tianhe.rentcars.entity.cheliangguanli.WeiXiu;
import com.yunhe.tianhe.rentcars.service.cheliangguanli.PriceService;
import com.yunhe.tianhe.rentcars.service.cheliangguanli.WeiXiuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Service
public class PriceServiceImpl implements PriceService {
    @Autowired
   private PriceDao priceDao;
    private Pageable<Price> pageable=new Pageable<>();

    @Override
    @ResponseBody
    public Pageable findPage(Integer limit, Integer offset,String carcode) {
        List<Price> list = priceDao.findPage1(limit,offset,carcode);
        int i = priceDao.findPage2();
        pageable.setRows(list);
        pageable.setTotal(Long.valueOf(i));
        return pageable;
    }

    @Override
    public void save(Price price) {
         priceDao.save(price);
    }

    @Override
    public Price findone(long carid) {
        return priceDao.findone(carid);
    }
}
